package com.example.rabbit.eight;

import com.example.rabbit.util.RabbitMqUtils;
import com.rabbitmq.client.BuiltinExchangeType;
import com.rabbitmq.client.Channel;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.TimeoutException;

/**
 * 消费者2
 *
 * @Author ifredomvip@gmail.com
 * @Date 2022/8/9 14:10
 * @Version 1.0.0
 * @Description
 **/
public class DeadConsumer2 {
    public static String deadQueueName = "dead_queue";

    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = RabbitMqUtils.getChannel();

        System.out.println("等待接收消息...");

        channel.basicConsume(deadQueueName, true, (consumeTag, delivery) -> {
            System.out.println("DeadConsumer2 收到消息" + new String(delivery.getBody(), StandardCharsets.UTF_8));

        }, (consumeTag) -> {
            System.out.println("没收到消息");
        });


    }
}
